<?php
/**
 * Created by 柚子i.
 * User: Emperor
 * Date: 2019/7/19
 * Time: 14:06
 */

namespace app\common\model\control;

use app\common\model\BaseModel;

class ControlPlanName extends BaseModel
{
    public function getPlanTrackList($planName)
    {
        $planList = self::hasWhere('planTrackItems', function ($query) {
            $query->where([
                "track" => 0,
                "step"  => 6,
            ]);
        })->where('plan_name', 'like', "%" . $planName . "%")
            ->select()->toArray();
        // ->paginate(10, true);
        $q = self::getLastSql();

        dump($planList);
        return $planList;
    }

    public function planTrackItems()
    {
        return $this->hasOne('ControlPlanStateTrack', 'plan_number', 'plan_number');
    }
}
